import bugAxios from "../model/paging/index";

export default {
  namespaced: true,

  state: {
    bugList: [],
    DeveloperNameList: [],
    total: null,
  },
  mutations: {
    getBugList(state, item) {
      state.bugList = item.data;
      state.total = item.count;
    },
    addBugList(state, item) {
      if (state.bugList.length < 5) {
        state.bugList = [...state.bugList, ...item];
        console.log(11111111111);
      }
    },
    getDeveloperNameList(state, item) {
      state.DeveloperNameList = item.filter((item) => item.type == 3);
    },
  },
  actions: {
    async getBugList({ commit }, item) {
      //获取BUG
      let { data } = await bugAxios.getBUgList(item);
      console.log(data);
      commit("getBugList", data);
    },


    async getDeveloperNameList({ commit }) {
      //获取BUG
      let { data } = await bugAxios.getDeveloperNameList();
      console.log(data);
      if (data.code == 1) {
        commit("getDeveloperNameList", data.list);
      }
    },

    async updateBug(ontext, item) {
      //更改BUG状态

      await bugAxios.update(item);
    },

  },
};
